﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace _0512063_0512082
{
    class Utilities
    {

        /// <summary>
        /// Xuất thông báo lỗi
        /// </summary>
        /// <param name="text2show"></param>
        public static void showErrorMessage(String text2show)
        {
            MessageBox.Show(text2show, MainForm.RM.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

        /// <summary>
        /// Thông báo cảnh báo
        /// </summary>
        /// <param name="text2show"></param>
        public static void showWarningMessage(String text2show)
        {
            MessageBox.Show(text2show, MainForm.RM.GetString("warning"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }

        /// <summary>
        /// Thông báo
        /// </summary>
        /// <param name="text2show"></param>
        public static void showNormalMessage(String text2show)
        {
            MessageBox.Show(text2show, MainForm.RM.GetString("info"), MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        /// <summary>
        /// Thông báo dừng
        /// </summary>
        /// <param name="text2show"></param>
        public static void showStopMessage(String text2show)
        {
            MessageBox.Show(text2show, MainForm.RM.GetString("stop"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
        }

        public static DialogResult showComfirmMessage(String confirmtext, String title)
        {
            return MessageBox.Show(confirmtext, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
        }
        public static String openSaveDialog(String filetype, String fileextension)
        {
            SaveFileDialog saveDialog = new SaveFileDialog();
            saveDialog.FileName = "Untitile";
            saveDialog.Filter = String.Format("{0} file (*.{1})|*.{2}",filetype, fileextension, fileextension);
            if (saveDialog.ShowDialog() == DialogResult.OK)
                return saveDialog.FileName;
            return String.Empty;
        }

        
    }
}
